/*
 * @Description: 
 * @Author: zoe
 * @Date: 2024-09-20 08:43:46
 * @LastEditors: rendc
 * @LastEditTime: 2024-09-20 10:56:52
 */
//派生类
public class Cat extends Animal{
     //成员变量
    private String type;
    //构造器
    public Cat(){
        System.out.println("无参构造器");
    }
    public Cat(String color,int age,String type){
        //第一行有效代码
        super(color,age);
        //赋值私有属性
        this.type = type;
    }
    //重写父类
    @Override
    public void eat(){
        System.out.println("猫吃鱼");
    }
    @Override
    public void sleep(){
        System.out.println("猫睡觉");
    }
    //重写object toString
    @Override
    public String toString(){
        String str0 = super.toString();
        String str = ",是猫,品种是:"+this,type;
        return str0+str;
    }
}
